<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="../jqgrid.jsp"></jsp:include>
</head>
<script type="text/javascript">
	$(document).ready(function() {
		jQuery("#buildinglist").jqGrid({
			url : 'queryBuilding.action',
			autowidth : true,
			datatype : "json",
			colNames : [ 'id', '编号', '位置', '总高(层)','建造时间','使用时间'],
			colModel : [ {
				name : 'id',
				index : 'id',
				width : 10,
				align : "center",
				hidden:true,
				editable : false,
				searchoptions :{
					sopt:['eq','ne']
				}
			}, {
				name : 'number',
				index : 'number',
				width : 10,
				align : "center",
				editable : true,
				editrules:{required:true},
				searchoptions :{
					sopt:['eq','ne']
				}
			}, {
				name : 'position',
				index : 'position',
				width : 40,
				align : "center",
				editable : true,
				editrules:{required:true},
				searchoptions :{
					sopt:['cn','nc']
				}
			}, {
				name : 'totalHeight',
				index : 'totalHeight',
				width : 20,
				align : "center",
				editable : true,
				editrules:{required:true,integer:true},
				searchoptions :{
					sopt:['eq','ne']
				}
			}, {
				name : 'buildingTime',
				index : 'buildingTime',
				width : 80,
				align : "center",
				editable : true,
				editrules:{required:true,date:true},
				formatter:"date",
				formatoptions:{"newformat":"Y-m-d"},
				 editoptions: {
		              size: 10, 
		              maxlengh: 10,
		              dataInit: function(element) {
		                  $(element).datepicker({ dateFormat: 'yy-mm-dd'});
		              }
		          },
				searchoptions:{dataInit:datePick,sopt:['le','ge']}
			}, {
				name : 'useTime',
				index : 'useTime',
				width : 80,
				align : "center",
				editable : true,
				formatter:"date",
				editrules:{required:true,date:true},
				formatoptions:{"newformat":"Y-m-d"},
				 editoptions: {
		              size: 10, 
		              maxlengh: 10,
		              dataInit: function(element) {
		                  $(element).datepicker({ dateFormat: 'yy-mm-dd'});
		              }
		          },
				searchoptions:{dataInit:datePick,sopt:['le','ge']}
			}],
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			pager : '#buildinggridPager',
			sortname : 'id',
			viewrecords : true,
			jsonReader : {
				repeatitems : false
			},
			sortorder : "desc",
			caption : "楼宇列表",
			editurl : "editBuilding.action",
		});
		jQuery("#buildinglist").jqGrid('navGrid', '#buildinggridPager', {
			edit : true,
			add : true,
			del : false
		}, {}, {}, {},{multipleSearch:true});
	});
	datePick = function(elem)
	{
	   jQuery(elem).datepicker();
	}
</script>
<body>
	 <div align="center">
		<table id="buildinglist"></table>
		<div id="buildinggridPager"></div>
	</div>
</body>
</html>